package com.aaa.pro.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * fileName:JHTakeOutDao
 * description:
 * author:JH
 * createTime:2020/3/7 15:41
 * version:1.0.0
 */
public interface JHTakeOutDao {

    /**
     * 查询所有外卖商品
     * @return
     */
    @Select("SELECT t.id,t.shop_id,t.name,t.sale,t.price,t.promotion_price,pic,product_category_id  FROM pms_product t where shop_id = 1")
    List<Map> getList();

    /**
     * 查询分类
     * @return
     */
    @Select("select id,name from pms_product_category where shop_id=1")
    List<Map> getPro();

    /**
     * 模糊查询
     * @param name
     * @return
     */
    @Select("<script>select t.id,t.shop_id,t.name,t.sale,t.price,t.promotion_price,pic  FROM pms_product t where 1=1 " +
            "<if test=\"name!=null || name !=''\"> and name like '%${name}%'</if></script>")
    List<Map> getChange(String name);

}
